//
//  SchemeheadView.m
//  liangyi
//
//  Created by 张水 on 17/1/13.
//  Copyright © 2017年 yswh. All rights reserved.
//

#import "SchemeheadView.h"
@implementation SchemeheadView

-(instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    
    if (self){
        [self setup];
    }
    return  self;
}
-(void)loadMySchemeData:(StageModel *)model{
    self.sectionName.text = [NSString stringWithFormat:@"%@",model.title];
    self.sectionDes.text = [NSString stringWithFormat:@"手术后%@后开始的训练项目,%@",model.operationDay,model.content];
}


-(void)setup{
    
    self.backgroundColor = [UIColor whiteColor];
    
    UILabel *myTrain = [[UILabel alloc]init];
    [self addSubview:myTrain];
    [myTrain mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(10);
        make.left.equalTo(self).offset(20);
    }];
    myTrain.text  = @"我的训练";
    myTrain.textColor = [UIColor ColorWithHex:@"#686868"];
    myTrain.font = [UIFont systemFontOfSize:15];
    myTrain.textAlignment = NSTextAlignmentLeft;
    
    UILabel *lineLabel = [[UILabel alloc]init];
    [self addSubview:lineLabel];
    [lineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(myTrain.mas_bottom).offset(10);
        make.left.right.equalTo(self);
        make.height.equalTo(@1);
    }];
    lineLabel.backgroundColor = [UIColor ColorWithHex:@"#adadad"];
    
    
    self.ModeiTime = [[UIButton alloc]init];
    [self addSubview:self.ModeiTime];
    [self.ModeiTime mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(myTrain.mas_right).offset(5);
        make.centerY.equalTo(myTrain.mas_centerY);
        make.width.equalTo(@200);
        make.height.equalTo(@40);
    }];
    [self.ModeiTime setTitleColor: [UIColor ColorWithHex:@"#686868"] forState:UIControlStateNormal];
    self.ModeiTime.titleLabel.font = [UIFont systemFontOfSize:14];
    
    
    self.ModeiScheme = [[UIButton alloc]init];
    [self addSubview:self.ModeiScheme];
    [self.ModeiScheme mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self).offset(-5);
        make.centerY.equalTo(myTrain.mas_centerY);
        make.width.equalTo(@50);
        make.height.equalTo(@30);
    }];
    self.ModeiScheme.backgroundColor = [UIColor ColorWithHex:@"#5bc9d7"];
    [self.ModeiScheme setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.ModeiScheme setTitle:@"修改" forState:UIControlStateNormal];
    
    self.desLable = [[UILabel alloc]init];
    [self addSubview:self.desLable];
    [self.desLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(lineLabel.mas_bottom).offset(5);
        make.left.equalTo(self).offset(10);
        make.right.equalTo(self).offset(-10);
    }];
    self.desLable.font = [UIFont systemFontOfSize:15];
    self.desLable.textColor = [UIColor grayColor];
    self.desLable.textAlignment = NSTextAlignmentLeft;
    self.desLable.numberOfLines = 0 ;
    
    
    self.sectionName = [[UILabel alloc]init];
    [self addSubview:self.sectionName];
    [self.sectionName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(lineLabel.mas_bottom).offset(40);
        make.centerX.equalTo(self.mas_centerX);
    }];
    self.sectionName.textColor = [UIColor ColorWithHex:@"#5bc4d2"];
    self.sectionName.font = [UIFont systemFontOfSize:26];
    self.sectionName.textAlignment = NSTextAlignmentCenter;
    
    
    self.sectionDes = [[UILabel alloc]init];
    [self addSubview:self.sectionDes];
    [self.sectionDes mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.sectionName.mas_bottom).offset(20);
        make.centerX.equalTo(self.mas_centerX);
        make.left.equalTo(self).offset(50);
        make.right.equalTo(self).offset(-50);
    }];
    self.sectionDes.numberOfLines = 0;
    self.sectionDes.textColor = [UIColor ColorWithHex:@"#c0c0c0"];
    self.sectionDes.font = [UIFont systemFontOfSize:18];
    self.sectionDes.textAlignment = NSTextAlignmentCenter;
    
    self.BeginTrain = [[UIButton alloc]init];
    [self addSubview:self.BeginTrain];
    [self.BeginTrain mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        make.top.equalTo(self.sectionDes.mas_bottom).offset(30);
        make.width.equalTo(@140);
        make.height.equalTo(@40);
    }];
    [self.BeginTrain setBackgroundImage:[UIImage imageNamed:@"iconSq1"] forState:UIControlStateNormal];
    [self.BeginTrain setTitle:@"开始训练  GO" forState:UIControlStateNormal];
}

@end
